Messages to the Monitor Function
Messages to the Monitor Function
The message passed as a parameter to the monitor function can have any of the
values defined by these constants:
initMsg = 1; initialization
okMsg = 2; user clicked OK button
cancelMsg = 3; user clicked Cancel button
hitMsg = 4; user clicked control in Options dialog box
nulMsg = 5; periodic event
updateMsg = 6; update event
activateMsg = 7; not used
deactivateMsg = 8; not used
keyEvtMsg = 9; keyboard event
superMsg = 10; show superuser controls
normalMsg = 11; show only normal controls
startupMsg = 12; code has been loaded
Constant Meaning
initMsg Sent before the Options dialog box is displayed, after the
Monitors control panel has located any resources (such as
'gama' resources) referred to by your monitor function.
When you receive this message you should execute initialization
code. You can use initialization code
to set default values for controls and allocate memory for
local storage, for example.
If you do allocate storage, be sure to pass a handle to the
storage as the function result. The next time your extension is
called, this value will be available in the monitorValue
parameter.
This message is preceded by the startup message and followed
by either the super message or the normal message.
okMsg Indicates the user has clicked the OK button. The OK button is
a standard control put in the Options dialog box by the Monitors
control panel. You should not make any changes irreversible
until you receive this message.
When the user clicks the OK button, the Monitors control
panel hides the Options dialog box and calls your monitor
function with this message. This is your last chance to check
the values of dialog items that the user might have changed. You
should release any private memory allocated by your extension
file before returning control to the Monitors control panel.
cancelMsg Indicates the user has clicked the Cancel button. The Cancel
button is a standard control put in the Options dialog box by the
Monitors control panel. Return the computer system to the
condition it was in before the user clicked the Options button,
release any private memory allocated by your extension file,
and return control to the Monitors control panel.
hitMsg Indicates the user has clicked an enabled control in the
Options dialog box. The dialog-item-list number of the control
is passed in the item parameter to the monitor function; see
the preceding section for a discussion of this parameter.
nulMsg Sent periodically to allow you to perform tasks that have to be
done repeatedly, such as blinking an insertion point. Do not
assume any particular timing for this message.
updateMsg Sent on every update event.
activateMsg Sent on every activate event for which the Options dialog box
becomes active. Currently, this message is not used, because
the Options dialog box is modal. However, you should handle
this message as you would any activate event, because in future
versions of the Operating System this dialog box might be
modeless.
deactivateMsg Sent on every activate event for which the Options dialog box
becomes inactive. Currently, this message is not used, because
the Options dialog box is modal. However, you should handle
this message as you would any activate event because in future
versions of the Operating System, this dialog box might be
modeless.
keyEvtMsg Sent on every keyboard event.
superMsg Indicates the user is a superuser-that is, the user can be
assumed to be very knowledgeable. This message is sent when
the user holds down the Option key while clicking the Options
button, and it could be sent by other mechanisms in the future.
You should display any controls that you have reserved for such
users.
This message or the normal message is sent immediately
following the initialization message.
normalMsg Indicates you should not display controls reserved for
superusers.
This message or the super message is sent immediately
following the initialization message.
startupMsg Sent as soon as the code in your 'mntr' resource has been
loaded, before the Monitors control panel finds any resources
referred to by your monitor function. You can then load and
modify any resources that must allow for the capabilities of the
computer system or for superusers. You can use this
opportunity, for example, to modify your 'DITL' resource to
display special controls for superusers.
You can call the Gestalt function to determine the
capabilities of the user's computer system, and you can check
the value of the item parameter to determine whether the user
is a superuser. If the user is a superuser, the Monitors
control panel sets the item parameter to 1 when it sends the
startup message.
This message is the first message sent.